<template>
<div style="height:220px;overflow:hidden;">
  <el-card class="box-card" shadow="never">
    <div slot="header" class="clearfix">
      <span>公文</span>
      <div style="float: right; padding: 3px 0" type="text">
        <a @click="showDetail()">查看全部 &gt;</a>
      </div>
    </div>
      <el-table :show-header="false" :data="off1" class="left_menu_side">
        <el-table-column prop="subject" :show-overflow-tooltip="true" label="公文名称">
          <template slot-scope="scope">
            <a @click="showSingle(scope.row)">{{scope.row.subject}}</a>
          </template>
        </el-table-column>
        <el-table-column prop="publisher" :show-overflow-tooltip="true" label="发布人" width="70"></el-table-column>
        <el-table-column prop="publishtime" :show-overflow-tooltip="true" label="发布时间" width="148"></el-table-column>
      </el-table>
  </el-card>
  </div>
</template>

<script type="text/javascript">
  import {ACCESS_TOKEN, ACCESS_TOKEN_IP} from "@/store/mutation-types"
  import Vue from 'vue'
  import {openIFrame } from '@/utils/util'

  export default {
    data () {
      return {
        off1:[]
      }
    },
    mounted(){
      this.getAdminList()
    },
    methods:{
      showSingle(record){
        let baseUrl = process.env.VUE_APP_ADD_HTTP;
        let ticket = Vue.ls.get(ACCESS_TOKEN);
        let docId = record.docid;
        let url = baseUrl + "/Modules/PublicDocument/view/view.htm?LoginMethod=ssologin&ticket=" +
          ticket + "&id=" + docId + "";
        openIFrame(record.docid,'/official/'+record.docid,record.subject,url)
        this.$router.push({ name: record.docid })
      },
      showDetail() {
        let ticket = Vue.ls.get(ACCESS_TOKEN);
        let ReturnUrl = encodeURIComponent('/Modules/PublicDocument/index.htm?request=DocumentList&request_type=2#');
        let baseUrl = process.env.VUE_APP_ADD_HTTP;
        let UserIP = "&UserIP="+ Vue.ls.get(ACCESS_TOKEN_IP);
        let url = baseUrl + "/login.xip?LoginMethod=ssologin&Ticket=" + ticket + UserIP + "&ReturnUrl=" + ReturnUrl + "";
        openIFrame("officialList",'/officialList',"公文列表",url)
        this.$router.push({ name: "officialList" })
      },
      getAdminList(){
        let that = this;
        let params = {
          serviceName:"Xinfo.Bus.BL.Service.EgovPlatform.PortalLet.PublicDocmentPortalLetService,Xinfo.Bus.BL.Service",
          guid:'rcgz_gw',
          getCount:true,
          intTypeId:8,
          strBizType:'',
          TaskType:1,
        }
        this.getRequest("/PortalLet/GetPortalLetData",params)
          .then(res => {
            res.data.forEach((row, index) => {
              if (index < 5) {
                that.off1.push(row)
              }
            });
          })
      },
    }
  }
</script>